package com.effectiv.crm.etl.impl;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import lombok.extern.slf4j.Slf4j;

import org.springframework.data.mongodb.core.MongoTemplate;

import com.effectiv.crm.domain.FileUploadDetails;
import com.effectiv.crm.etl.api.LoadStrategy;

@Named
@Slf4j
public class CommonLoadStrategy implements LoadStrategy {
	
	@Inject
	private MongoTemplate template;
	
	@Override
	public void load(List l, FileUploadDetails fd, Class c) {
		log.info("Mongo Template - {}", template);
		
		template.insertAll(l);
	}

	@Override
	public boolean canLoad(FileUploadDetails fd, Class c) {
		return true;
	}

}
